package com.home766.controller.terminal;

import net.biz.Pageable;
import net.biz.controller.shop.BaseController;
import net.biz.service.SearchService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

@Controller
@RequestMapping("/terminal")
public class TerminalController extends BaseController {
	
	@Resource(name="searchServiceImpl")
	private SearchService searchService;
	
	@RequestMapping(value="/index")
	public String index(){
		return "terminal/index";
	}
	
	/**
	 * 搜索
	 */
	@RequestMapping(value = "/search", method = RequestMethod.GET)
	public String search(ModelMap model, String keyword, Pageable pageable) {
		model.addAttribute("page", searchService.search(keyword, null,null,null,pageable));
		model.addAttribute("productKeyword", keyword);
		return "/terminal/product/list";
	}
}
